package gateway.internal.api.message;

import gateway.api.message.Context;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;

/**
 * @author Jin Zheng
 * @since 1.0 2020-09-15
 */
public class DefaultContext implements Context
{
	private final ExecutorService executor;
	private final Map<String, Object> args = new HashMap<>();
	private final Map<String, String> routeArgs;

	public DefaultContext(ExecutorService executor, Map<String, String> routeArgs)
	{
		this.executor = executor;
		this.routeArgs = routeArgs;
	}

	@Override
	public ExecutorService executor()
	{
		return executor;
	}

	@Override
	public Map<String, Object> args()
	{
		return args;
	}

	@Override
	public Object getArg(String key)
	{
		return args.get(key);
	}

	@Override
	public void putArg(String key, Object value)
	{
		args.put(key, value);
	}

	@Override
	public Map<String, String> routeArgs()
	{
		return routeArgs;
	}
}
